package com.itheima.app.mapper;

import com.itheima.health.model.pojos.Member1;
import com.itheima.health.model.pojos.Order;
import com.itheima.health.model.pojos.OrderSetting;
import com.itheima.health.model.vos.OrderVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.time.LocalDate;

@Mapper
public interface OrderMapper {
    @Select("select * from t_ordersetting where orderDate=#{orderDate}")
    OrderSetting selectByOrderDate(LocalDate orderDate);
    @Select("select * from t_member where phoneNumber = #{telephone}")
    Member1 selectByCondition(String telephone);
    @Select("select * from t_member where phoneNumber = #{telephone}")
    void addMember(Member1 mm);

    @Select("select * from t_order where member_id=#{memberId} and setmeal_id=#{setmealId} and orderDate=#{orderDate}")
    Order selectByCondition(Integer id, String setmealId, LocalDate orderDate);

    void add(Order od);

    @Select("update t_ordersetting set number=number+1 where orderDate=#{orderDate}")
    void updateByOrderDate(OrderSetting orderSetting);

    OrderVo findById(Integer id);
}
